package com.smh.a01IOStreamDemo1;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class IOStreamDemo6 {
    public static void main(String[] args) throws IOException {

        //拷贝
        //很慢,因为一次读一个字节
        //可以一次传一个数组数据
        FileInputStream fis = new FileInputStream("day26-code\\file\\a.txt");
        FileOutputStream fos = new FileOutputStream("day26-code\\file\\b.txt");
        long start = System.currentTimeMillis();
        int b;
        while ((b = fis.read()) != -1) {
            fos.write(b);
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);
        fos.close();
        fis.close();//先创建,后关闭

    }
}
